package com.xdtech.hotel.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.sql.Timestamp;

import com.xdtech.core.orm.utils.BeanUtils;
import com.xdtech.hotel.model.DeviceLinkOption;

import com.xdtech.web.freemark.item.GridColumn;

/**
 * 
 * @author max.zheng
 * @create 2015-04-04 11:13:09
 * @since 1.0
 * @see
 */
public class DeviceLinkOptionItem implements Serializable{
	private static final long serialVersionUID = 1L;
	private Long id;
	@GridColumn(title="属性名称",width=100)
	private String name;
	@GridColumn(title="属性值",width=100)
	private String val;

	public void setId(Long id) {
		this.id = id;
	}
	public Long getId() {
		return id;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}
	
	public void setVal(String val) {
		this.val = val;
	}
	public String getVal() {
		return val;
	}
	
	/**
	 * 根据model构建vo
	 * 
	 * @author max
	 * @return
	 */
	public static DeviceLinkOptionItem createItem(DeviceLinkOption deviceLinkOption) {
		DeviceLinkOptionItem deviceLinkOptionItem = new DeviceLinkOptionItem();
		BeanUtils.copyProperties(deviceLinkOptionItem, deviceLinkOption);
		//自定义属性设置填充
		return deviceLinkOptionItem;
	}
	/**
	 * 根据model集合创建vo集合
	 * 
	 * @author max
	 * @return
	 */
	public static List<DeviceLinkOptionItem> createItems(List<DeviceLinkOption> deviceLinkOptions) {
		List<DeviceLinkOptionItem> deviceLinkOptionItems = new ArrayList<DeviceLinkOptionItem>();
		for (DeviceLinkOption deviceLinkOption : deviceLinkOptions) {
			deviceLinkOptionItems.add(createItem(deviceLinkOption));
		}
		return deviceLinkOptionItems;
	}
}
